package com.commerce.recording.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.commerce.recording.R;
import com.commerce.recording.entity.Sign;
import com.commerce.recording.utils.FormatDate;


import java.util.Collections;
import java.util.List;

public class MylistAdapter extends BaseAdapter {

    Context context;
    List<Sign> list;

    public MylistAdapter(Context context, List<Sign> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    private static class ViewHolder{
        TextView textView;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if(convertView==null){
        convertView = LayoutInflater.from(context).inflate(R.layout.sgin_layout,null);
        viewHolder = new ViewHolder();
        viewHolder.textView= convertView.findViewById(R.id.text_sign);
        convertView.setTag(viewHolder);
        }else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        String time = FormatDate.tommss(list.get(position).getaLong());
        viewHolder.textView.setText(time);
        return convertView;
    }
}
